/**
 * 响应拦截
 * @param {Object} vm 
 */
module.exports = (vm) => {
    uni.$u.http.interceptors.response.use(
        (response) => {
            const { data, config } = response;
            console.log('响应拦截', data, config)
            console.log('111', data.code)
            if (data.code != 200) {
                const errorMsg = data.msg || data.message || '请求失败';
                uni.showToast({title: errorMsg, icon: 'none'}); 
                // return data;
            }
            return data;
        },
        (error) => {
            const errorMsg = error?.response?.data?.msg || '网络错误';
            uni.$u.toast(errorMsg);
            return Promise.reject(error);
        }
    );
};


